{include file='header.tpl'}
<div id="content">
    <div class="breadcrumb">
            <span class="raquo"></span><a href="/">Главная</a>
           
           <span class="raquo"> &raquo; </span><a href="{geturl controller='basket' action='index'}">Корзина</a>  
    </div>
<h1 class="prof-title">Корзина </h1>
<div class="cart" style="">
    {if $baskets}
    {foreach from=$baskets item=basket}
            <div class="buskpole" id="master_{$basket.user->getId()}">
		<div class="nameprodavez">
		<div class="name1">
					 <p>{$basket.user->first_name} ({$basket.user->nameshop})</p>
						<span>{$basket.user->country}, {$basket.user->city}</span>
					</div>
			 		<div class="name2"><a href="javascript:void(0);" onclick="removeByMaster({$basket.user->getId()}, 'cart');">Убрать все</a></div>
					<div class="clear"></div>
			 		</div>
			<div class="tables">
			<div class="cart-info">
                            
         <table>
        <thead>
          <tr>
            <td class="image">Фото</td>
            <td class="name">Наименование товара</td>
            <td class="model">Модель</td>
            <td class="quantity"><span title="Количество">Кол-во</span></td>
            <td class="price">Цена</td>
            <td class="total">Итого</td>
          </tr>
        </thead>
		<tbody>
                     {foreach from=$basket.products item=product name="kk"}   
                    <tr id="item_{$product->getId()}">
            <td class="image"> 
                <a href="{getsuburl route='shopproduct' name=$basket.user->nameshop action='item' id=$product->getId()}">
                    <img src="{$product->logo}" alt="{$product->name}" title="{$product->name}" width="49px"/>
                </a>
              </td>
            <td class="name"><a href="{getsuburl route='shopproduct' name=$basket.user->nameshop action='item' id=$product->getId()}">{$product->name}</a>
                             
              </td>
            <td class="model">{$product->name}</td>
            <td class="quantity"><input type="text" id="count_{$basket.cartId[$smarty.foreach.kk.index]}" value="{$basket.count[$smarty.foreach.kk.index]}" size="1" />
              &nbsp;
              <input type="image" src="/images/update.png" onclick="Update({$basket.cartId[$smarty.foreach.kk.index]},{$product->getID()})" alt="Применить" title="Применить" />
              &nbsp;<a  href="javascript:void(0);" onclick="removeItem({$product->getID()}, {$basket.user->getId()},'cart');"><img src="/images/remove.png" alt="Удалить" title="Удалить" /></a></td>
            <td class="price">{$product->price} {$currency}</td>
            <td class="total">{$basket.priceproduct[$smarty.foreach.kk.index]} {$currency}</td>
          </tr>
		{/foreach}   
                  </tbody>
		
		</table>
	</div>
			<div class="cart-total">
    <table id="total">
            <tr>
        <td class="right"><b>Итого:</b></td>
        <td class="right" ><span id="total_{$basket.user->getId()}">{$basket.price}</span> {$currency}</td>
      </tr>
          </table>
  </div>  </div>
			  <div class="formzakaz">
			<form action="{geturl controller="basket" action="checkout"}" method="post">
			<div>Куда доставить:    </div>
			<input name="address" type="text" value="{if $user}{$user->country}, {$user->region}, {$user->city}{/if}"   class="inpbusk"> 
			<div>Способ доставки:  </div>
                        <select name="pc" style="width: 263px;margin: 3px 0px 10px 0px;">
                             {if $basket.user->shop->pc21!=null} <option value="21">Самовывоз</option>{/if}
                             {if $basket.user->shop->pc22!=null} <option value="22">Доставка курьером</option>{/if}
                             {if $basket.user->shop->pc23!=null} <option value="23">Почтовая служба</option>{/if}
                        </select>
			<!--<input name="" type="text" value="доставка почтой."  class="inpbusk"> -->
			<div>Способ оплаты:   	</div>
                        <select name="pc1" style="width: 263px;margin: 3px 0px 10px 0px;">
                           {if $basket.user->shop->pc2!=null} <option value="2">Наличные</option>{/if}
                           {if $basket.user->shop->pc3!=null} <option value="3">Банковский перевод на счёт</option>{/if}
                           {if $basket.user->shop->pc4!=null} <option value="4">Почтовый перевод</option>{/if}
                           {if $basket.user->shop->pc5!=null} <option value="5">Перевод на банковскую карту</option>{/if}
                           {if $basket.user->shop->pc6!=null} <option value="6">Электронные платёжные системы</option>{/if}
                           {if $basket.user->shop->pc7!=null} <option value="7">Система денежных переводов</option>{/if}
                           {if $basket.user->shop->pc8!=null} <option value="8">Пополнение счёта мобильного телефона</option>{/if}
                           {if $basket.user->shop->pc9!=null} <option value="9">Наложенный платёж</option>{/if}
                           {if $basket.user->shop->pc10!=null} <option value="10">Другие условия оплаты</option>{/if}
                           
                        </select>
                       
                       <!-- <input name="" type="text" value="наличными"  class="inpbusk">-->
			<input name="shopId" type="hidden" value="{$basket.user->getId()}"  class="inpbusk">
			
			<div class="zakazbt"><center>
                           {if $nomail=='0'}     <input name="" type="submit" value="Оформление заказа" class="button pink">
                            {else}
                            Вы сможете совершать покупки только после подтверждения E-mail 
                            {/if}
                            </center></div></form> 
			</div>
			 
          
			<div class="clear"></div>
			</div>
                  


    <div class="clear sep-v-50"></div>
   
</div>
</form>
<br><br><br>
{/foreach} 
 {else}
        <p style="text-align:center;">Вы пока не добавили товары в корзину</p>
        <a href="{geturl controller="index" action="catalog"}" style="float:center;" class="button pink">Продожить покупки</a>
        {/if}
</div>
{literal}
    <script>
        function Update(id,prod) 
        {
            var count = $('#count_'+id).val();
          
                       $.post(
                    '/basket/update',
                    {id: prod, count: count},
                    function(data){
                    window.location.reload()
                    }
            );
        }
        </script>
    {/literal}
{include file='footer.tpl'}